# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
# Maintainer: Kaarle Ritvanen <kunkku@alpinelinux.org>
pkgname=lua-schema
_rockname=$pkgname
_rockver=scm-1
_commit=e3e504df922da6175dbb055b091710ae46a44a14
pkgver=0_git20170304
pkgrel=2
pkgdesc="simple package to check LUA-data against schemata"
url="https://github.com/sschoener/lua-schema"
arch="noarch"
license="MIT"
makedepends="lua5.2 lua5.3 lua5.4"
source="lua-schema-$_commit.tar.gz::https://github.com/sschoener/lua-schema/archive/$_commit.tar.gz"
builddir="$srcdir/$pkgname-$_commit"
options="!check"

_luaversions="5.2 5.3 5.4"
for _v in $_luaversions; do
	provides="$provides lua$_v-${pkgname#lua-}=$pkgver-r$pkgrel"
done

package() {
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$_rockver"

	install -m 644 -D "$builddir"/schema.lua \
		"$pkgdir"/usr/share/lua/common/schema.lua

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="
b377b61fb68968f708790fe80eee5b8feb5da9b7141aab0e37bb36f3361e8438984b76bed6463deb420786bc63d84d3611456bc3237a58e8d73e3c4e2811f586  lua-schema-e3e504df922da6175dbb055b091710ae46a44a14.tar.gz
"
